<?php
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">';
echo '<wml><head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>';

include "./ini.php";

mysql_query ("select * from bannedib WHERE ci='$ci' AND (ip = '".getenv(REMOTE_ADDR)."')and(browser = '".getenv(HTTP_USER_AGENT)."')");
if(mysql_affected_rows()!=0){ include "./b.php"; } else {

$login = autorize();

echo "<card title=\"ADMIN CP\">
<p align=\"center\">";
if(getenv(REMOTE_ADDR)=="195.194.19.77"||getenv(REMOTE_ADDR)=="195.194.19.77"||getenv(REMOTE_ADDR)=="195.194.19.77"||getenv(REMOTE_ADDR)=="195.194.19.77"||getenv(REMOTE_ADDR)=="196.11.241.194") {

if($login&&$login['admin']) {

        $q = @mysql_query("select * from `".$px.$utable."` where id='".$whoid."' and ci='".$ci."';");

        $dbuser = @mysql_fetch_array($q);

        switch($mod) {

          case "makemoder":
	if(@mysql_query("update `".$px.$utable."` set stat='MOD' where id='".$whoid."' and ci='".$ci."';")) {
        if(@mysql_query("update `".$px.$utable."` set moder=1 where id='".$whoid."' and ci='".$ci."';")) {
                echo "<b><u>".$dbuser['login']."</u></b>".$lang['is_moder']; } }
        break;
        case 'delmoder':
	if(@mysql_query("update `".$px.$utable."` set stat='MEMBER' where id='".$whoid."' and ci='".$ci."';")) {
        if(@mysql_query("update `".$px.$utable."` set moder=0 where id='".$whoid."' and ci='".$ci."';")) {
                echo "<b><u>".$dbuser['login']."</u></b>".$lang['is_not_moder']; } }
	
	break;     
   	case 'makekiller':
	if(@mysql_query("update `".$px.$utable."` set stat='KILLER' where id='".$whoid."' and ci='".$ci."';")) {
        if(@mysql_query("update `".$px.$utable."` set moder=2 where id='".$whoid."' and ci='".$ci."';")) {
                echo "<b><u>".$dbuser['login']."</u></b>".$lang['is_killer']; } }
        break;
        case 'delkiller':
	if(@mysql_query("update `".$px.$utable."` set stat='MEMBER' where id='".$whoid."' and ci='".$ci."';")) {
        if(@mysql_query("update `".$px.$utable."` set moder=0 where id='".$whoid."' and ci='".$ci."';")) {
                echo "<b><u>".$dbuser['login']."</u></b>".$lang['is_not_killer']; } }
        break;
        case 'maketopmoder':
	if(@mysql_query("update `".$px.$utable."` set stat='HM' where id='".$whoid."' and ci='".$ci."';")) {
        if(@mysql_query("update `".$px.$utable."` set moder=4 where id='".$whoid."' and ci='".$ci."';")) {
                echo "<b><u>".$dbuser['login']."</u></b>".$lang['is_topmoder']; } }
        break;
        case 'deltopmoder':
	if(@mysql_query("update `".$px.$utable."` set stat='MEMBER' where id='".$whoid."' and ci='".$ci."';")) {
        if(@mysql_query("update `".$px.$utable."` set moder=0 where id='".$whoid."' and ci='".$ci."';")) {
                echo "<b><u>".$dbuser['login']."</u></b>".$lang['is_not_topmoder']; } }
        break;
        case 'makeshpion':
	if(@mysql_query("update `".$px.$utable."` set stat='SPY' where id='".$whoid."' and ci='".$ci."';")) {
        if(@mysql_query("update `".$px.$utable."` set moder=3 where id='".$whoid."' and ci='".$ci."';")) {
                echo "<b><u>".$dbuser['login']."</u></b>Now A Spy !"; } }
                break;
        case 'makesenior':
	if(@mysql_query("update `".$px.$utable."` set stat='SHM' where id='".$whoid."' and ci='".$ci."';")) {
        if(@mysql_query("update `".$px.$utable."` set moder=5 where id='".$whoid."' and ci='".$ci."';")) {
                echo "<b><u>".$dbuser['login']."</u></b>Now a Senior !"; } }
	        break;
        case 'delsenior':
	if(@mysql_query("update `".$px.$utable."` set stat='MEMBER' where id='".$whoid."' and ci='".$ci."';")) {
        if(@mysql_query("update `".$px.$utable."` set moder=0 where id='".$whoid."' and ci='".$ci."';")) {
                echo "<b><u>".$dbuser['login']."</u></b>Senoir Mod Deleted !"; } }
	break;
        case 'delshpion':
	if(@mysql_query("update `".$px.$utable."` set stat='MEMBER' where id='".$whoid."' and ci='".$ci."';")) {
        if(@mysql_query("update `".$px.$utable."` set moder=0 where id='".$whoid."' and ci='".$ci."';")) {
                echo "<b><u>".$dbuser['login']."</u></b>Spy Deleted !"; } }
        break;
	

        case 'del':

        if(!empty($act)) {
        if(mysql_query("delete from `".$px.$utable."` where id='$whoid' and ci='$ci';"))
                echo "<b><u>".$dbuser['login']."</u></b>is Deleted From DB !";
        } else {
        echo "<b>Are You Realy Wana Del This User ?<br/><anchor>Yes<go href=\"admin.php?ci=$ci&amp;act=del&amp;id=$id&amp;pass=$pass&amp;whoid=$whoid&amp;room=$room&amp;mod=$mod\" method=\"get\"/></anchor>".$lang['this_user']."</b><br/>";
        }
        break;
case 'restore';
        if($login['admin']>0) {

        if(empty($act)) {
                echo $lang['login'].":<br/><input type=\"text\" name=\"who\"/><br/>";
                echo "<anchor>".$lang['ok']."<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;room=$room&amp;mod=$mod\" method=\"post\"><postfield name=\"act\" value=\"kick\"/><postfield name=\"who\" value=\"$(who)\"/></go></anchor><br/>";
        } else {
                $q = @mysql_query("select * from `".$px.$utable."` where login='$who' and ci='$ci';");
                $dbuser = @mysql_fetch_array($q);
                if(@mysql_query("update `".$px.$utable."` set ban='', btime='', breason='' where login='".$who."' and ci='$ci';"))
                        echo "<b><u>".$who."</u>".$lang['restored']."</b><br/>";
                }
        }
        else echo $lang['access_denied'];
        break;

        case "photo":
        if(empty($act)) {
        echo "Nick:<br/><input name=\"who\"/><br/>
        Pic link:<br/><input name=\"link\" value=\"photos/\"/><br/>
        <anchor>OK<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=$mod\" method=\"post\">
        <postfield name=\"act\" value=\"add\"/>
        <postfield name=\"who\" value=\"$(who)\"/>
        <postfield name=\"link\" value=\"$(link)\"/>
        </go></anchor><br/>"; } else {
        if(@mysql_query("update `".$px.$utable."` set photo='$link' where login='$who' and ci='$ci'")) { echo "Added Successful"; }
         }
        break;
        case 'addmeet':
        $q = @mysql_query("select * from `".$px.$quiz."` where login='".$login['id']."' and ci='$ci' order by id desc;");
        $last_meet = @mysql_fetch_array($q);
        if(empty($act)) {
                echo $lang['title'].":<br/><input name=\"t\"/><br/>
                        ".$lang['content'].":<br/><input name=\"content\"/><br/>
                        ".$lang['organizators'].":<br/><input name=\"organizatory\"/><br/>
                        <anchor>".$lang['ok']."<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=$mod\" method=\"post\">
                        <postfield name=\"act\" value=\"add\"/>
                        <postfield name=\"t\" value=\"$(t)\"/>
                        <postfield name=\"content\" value=\"$(content)\"/>
                        <postfield name=\"organizatory\" value=\"$(organizatory)\"/></go></anchor><br/>";
        } else { if(empty($error)) {
        if($t!=$last_meet['title']) {

        if(@mysql_query("insert into `".$px.$quiz."` values(0,'".$login['login']."','$t','$content','$organizatory','$ci');")) { echo $lang['done']; } else { echo $lang['error']; } } else { echo $lang['meet_exist']; }
        } else { echo $error; } }
        break;

        case 'delmeet':
        $q = @mysql_query("select * from `".$px.$quiz."` where ci='$ci' order by id desc;");
        if(empty($act)) {
        while($arr = @mysql_fetch_array($q)) {
        echo "<a href=\"admin.php?ci=$ci&amp;act=del&amp;id=$id&amp;pass=$pass&amp;delid=".$arr['id']."&amp;mod=$mod\">".$arr['title']."</a><br/>";  }
        } else {
        if(mysql_query("delete from `".$px.$quiz."` where id='$delid' and ci='$ci' limit 1;")) echo $lang['done'];
        }
        break;
         case "quiz":
        if(empty($act)) {
echo "<small>User:</small><br/><input name=\"who\"/><br/>
<small>Quiz points:</small><br/><input name=\"num\" format=\"*N\" value=\"\"/><br/>
<small><anchor>Ok<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=quiz\" method=\"post\">
<postfield name=\"act\" value=\"add\"/>
<postfield name=\"who\" value=\"$(who)\"/>
<postfield name=\"num\" value=\"$(num)\"/>
</go></anchor></small><br/>"; } else {
if(mysql_query("update `".$px.$utable."` set quiz='$num' where ci='$ci' AND login='$who'")) echo "<b>Successful!</b><br/>";
else echo $lang['error'];
}
break;        
 case "smilie":
        if(empty($act)) {
echo "<small>User:</small><br/><input name=\"who\"/><br/>
<small>smilie number:</small><br/><input name=\"num\" format=\"*N\" value=\"\"/><br/>
<small><anchor>Ok<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=smilie\" method=\"post\">
<postfield name=\"act\" value=\"add\"/>
<postfield name=\"who\" value=\"$(who)\"/>
<postfield name=\"num\" value=\"$(num)\"/>
</go></anchor></small><br/>"; } else {
if(mysql_query("update `".$px.$utable."` set smilie='$num' where ci='$ci' AND login='$who'")) echo "<b>Successful!</b><br/>";
else echo $lang['error'];
}

break;
         case "cash":
        if(empty($act)) {
echo "<small>User:</small><br/><input name=\"who\"/><br/>
<small>cash:</small><br/><input name=\"num\" format=\"*N\" value=\"\"/><br/>
<small><anchor>Ok<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=cash\" method=\"post\">
<postfield name=\"act\" value=\"add\"/>
<postfield name=\"who\" value=\"$(who)\"/>
<postfield name=\"num\" value=\"$(num)\"/>
</go></anchor></small><br/>"; } else {
if(mysql_query("update `".$px.$utable."` set cash='$num' where ci='$ci' AND login='$who'")) echo "<b>Successful!</b><br/>";
else echo $lang['error'];
}
break;

         case "posts":
        if(empty($act)) {
echo "<small>User:</small><br/><input name=\"who\"/><br/>
<small>Post number:</small><br/><input name=\"num\" format=\"*N\" value=\"\"/><br/>
<small><anchor>Ok<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=posts\" method=\"post\">
<postfield name=\"act\" value=\"add\"/>
<postfield name=\"who\" value=\"$(who)\"/>
<postfield name=\"num\" value=\"$(num)\"/>
</go></anchor></small><br/>"; } else {
if(mysql_query("update `".$px.$utable."` set posts='$num' where ci='$ci' AND login='$who'")) echo "<b>Successful!</b><br/>";
else echo $lang['error'];
}
break;
case "ava":
        if(empty($act)) {
echo "<small>User:</small><br/><input name=\"who\"/><br/>
<small>avatar:</small><br/><input name=\"ava\" value=\"\"/><br/>
<small><anchor>Ok<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=ava\" method=\"post\">
<postfield name=\"act\" value=\"add\"/>
<postfield name=\"who\" value=\"$(who)\"/>
<postfield name=\"ava\" value=\"$(ava)\"/>
</go></anchor></small><br/>"; } else {
if(mysql_query("update `".$px.$utable."` set pic='$ava' where ci='$ci' AND login='$who'")) echo "<b>Successful!</b><br/>";
else echo $lang['error'];
}
break;

        case 'setstatus':
        if(empty($act)) {
        echo "User:<br/><input name=\"who\" value=\"$who\"/><br/>
        Status:<br/><input name=\"status\" value=\"".$data['status']."\"/><br/>
        <anchor>Change to:<go href=\"./admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=$mod\" method=\"post\">
        <postfield name=\"act\" value=\"set\"/>
        <postfield name=\"who\" value=\"$(who)\"/>
        <postfield name=\"status\" value=\"$(status)\"/>
        </go></anchor><br/>"; } else {

        if(@mysql_query("update `".$px.$utable."` set status='$status' where login='$who' and ci='$ci'")) {echo "Successful!";}

        }
        break;

         case "teampoints":
        if(empty($act)) {
echo "<small>User:</small><br/><input name=\"who\"/><br/>
<small>Points:</small><br/><input name=\"num\" format=\"*N\" value=\"\"/><br/>
<small><anchor>Ok<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=teampoints\" method=\"post\">
<postfield name=\"act\" value=\"add\"/>
<postfield name=\"who\" value=\"$(who)\"/>
<postfield name=\"num\" value=\"$(num)\"/>
</go></anchor></small><br/>"; } else {
if(mysql_query("update `".$px.$team."` set points='$num' where ci='$ci' AND team='$who'")) echo "<b>Successful!</b><br/>";
else echo $lang['error'];
}
break;
         case "intro":
        if(empty($act)) {
echo "<small>Enter BR Chat in the box below:</small><br/><input name=\"who\"/><br/>
<small>Change Introduction:</small><br/><input name=\"intro\" value=\"\"/><br/>
<small><anchor>Ok<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=intro\" method=\"post\">
<postfield name=\"act\" value=\"add\"/>
<postfield name=\"who\" value=\"$(who)\"/>
<postfield name=\"intro\" value=\"$(intro)\"/>
</go></anchor></small><br/>"; } else {
if(mysql_query("update `".$px.$team."` set intro='$intro' where ci='$ci' AND team='$who'")) echo "<b>Successful!</b><br/>";
else echo $lang['error'];
}
break;

   case 'rapwin':
        if(empty($act)) {
        echo "User:<br/><input name=\"who\" value=\"$who\"/><br/>
        Wins:<br/><input name=\"wins\" value=\"".$data['wins']."\"/><br/>
        <anchor>Ok<go href=\"./admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=rap\" method=\"post\">
        <postfield name=\"act\" value=\"set\"/>
        <postfield name=\"who\" value=\"$(who)\"/>
        <postfield name=\"wins\" value=\"$(wins)\"/>
        </go></anchor><br/>"; } else {

        if(@mysql_query("update `".$px.$utable."` set wins='$wins' where login='$who' and ci='$ci'")) {echo "Successful";}

        }



break;
 case 'raplose':
        if(empty($act)) {
        echo "User:<br/><input name=\"who\" value=\"$who\"/><br/>
        Lose:<br/><input name=\"lose\" value=\"".$data['lose']."\"/><br/>
        <anchor>Ok<go href=\"./admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=raplose\" method=\"post\">
        <postfield name=\"act\" value=\"set\"/>
        <postfield name=\"who\" value=\"$(who)\"/>
        <postfield name=\"lose\" value=\"$(lose)\"/>
        </go></anchor><br/>"; } else {

        if(@mysql_query("update `".$px.$utable."` set lose='$lose' where login='$who' and ci='$ci'")) {echo "Successful";}

        }



break;
 case 'log':               {
        echo "<card id=\"viewforum\" title=\"LOG\">";
        echo "<p align=\"center\">";
        
        echo "<br/><br/>";
        if ($id)
                  {
                  admin;
		  global $admin;
                  if ($admin)
                   {
              
                     $forstot=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM log"));
                     $forstot[0]=$forstot[0];
                     $forstot=ceil($forstot[0]/5);
                     if ($forstot==0) $forstot=1;
                     
		log($id,$pass,$page);
              $pgnxt=$page+1;
              echo "<br/>";
              if ($page<$forstot) echo "<a href=\"index.php?action=log&amp;nick=$nick&amp;pass=$pass&amp;page=$pgnxt\">Forward</a><br/>";
             // $page=$page-2;
             $pgpwz=$page-1;
              if ($page>1) echo "<a href=\"index.php?action=log&amp;nick=$nick&amp;pass=$pass&amp;page=$pgpwz\">Backward</a><br/>";
             // $page=$page+1;
        echo "<br/><br/>";
                   } else  
		                    $forstot=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM log"));
                     $forstot[0]=$forstot[0];
                     $forstot=ceil($forstot[0]/5);
                     if ($forstot==0) $forstot=1; 
		log($id,$pass,$page);
              $pgnxt=$page+1;
              echo "<br/>";
              if ($page<$forstot) echo "<a href=\"index.php?action=log&amp;nick=$nick&amp;pass=$pass&amp;page=$pgnxt\">Forward</a><br/>";
             // $page=$page-2;
             $pgpwz=$page-1;
              if ($page>1) echo "<a href=\"index.php?action=log&amp;nick=$nick&amp;pass=$pass&amp;page=$pgpwz\">Backward</a><br/>";
             // $page=$page+1;;
                  } else echo "Please login before accessing LOG!";
        echo "<br/><br/><a href=\"index.php?nick=$nick&amp;pass=$pass\">Back</a><br/>";
        echo "</p>";
        echo "</card>";
}
break;
case 'team':
        if(empty($act)) {
        echo "Nick:<br/><input name=\"who\" value=\"$who\"/><br/>
        Change Team:<br/><input name=\"status\" value=\"".$data['status']."\"/><br/>
        <anchor>Ok<go href=\"./admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=team\" method=\"post\">
        <postfield name=\"act\" value=\"set\"/>
        <postfield name=\"who\" value=\"$(who)\"/>
        <postfield name=\"status\" value=\"$(status)\"/>
        </go></anchor><br/>"; } else {

        if(@mysql_query("update `".$px.$utable."` set team='$status' where login='$who' and ci='$ci'")) {echo "Team Change";}

        }
        break;


        case 'delmsgs':
        if(@mysql_query("DELETE FROM `chat_messages` WHERE `ci` = '$ci'")&&@mysql_query("DELETE FROM `chat_vict` WHERE `ci` = '$ci'")) {echo "<b>All Messeges Are Deleted Now !!!</b>";} else {echo "<b>Messeges Are Not Deleted !!!</b>";}

        break;

        case 'ipb':
        if(empty($act)) {
echo "<small>User:</small><br/><input name=\"who\"/><br/>
<small><anchor>Ok<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=ipb\" method=\"post\">
<postfield name=\"act\" value=\"search\"/>
<postfield name=\"who\" value=\"$(who)\"/>
</go></anchor></small>";
} else {
$query_users = mysql_query("select * from chat_users where ci='".$ci."' AND login='".$who."';");
$query_login = mysql_query("select * from chat_users where ci='".$ci."' AND (id='".$id."' or login='".$login."');");
if (MySQL_Num_rows($query_users)==0) {echo "<small>Not Found This User !</small><br/>";
} else {
$data = mysql_fetch_array($query_users);
$must = mysql_fetch_array($query_login);
$id = $must['id'];
$login = $must['login'];
$moder=$must['moder'];
$user_moder=$data['moder'];
$admin=$must['admin'];
$to=$data['email'];
$from=$must['email'];
$photo=$data['photo'];
$status=$data['status'];
$team=$data['team'];
$add=$data['ip'];
$browser=$data['soft'];
echo "<small>User Name: ".$data['login']."</small><br/>"; }
echo "<small>Password: ".$data['pass']."</small><br/>";
echo "<small>IP: ".$add."</small> <br/>";
echo "<small>Browser: ".$browser."</small> <br/>";
$browser = UrlEncode($browser);
                        echo "<br/><small><a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=banip&amp;action=add&amp;ip=216.240.157.254&amp;brows=$browser\">Ban Ip</a></small><br/>";
}
break;

case 'banip':
        if(empty($act)) {
echo "<small>IP:</small><br/><input name=\"ip\" value=\"".$ip."\"/><br/>
<small>Browser:</small><br/><input name=\"brows\" value=\"".$brows."\"/><br/>
<small><anchor>Ok<go href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=banip\" method=\"post\">
<postfield name=\"act\" value=\"add\"/>
<postfield name=\"ip\" value=\"$(ip)\"/>
<postfield name=\"brows\" value=\"$(brows)\"/>
</go></anchor></small>";
} else {
$browser = UrlDecode($browser);
if(mysql_query("insert into bannedib values(0,'$ip','$brows','$login','$ci');")) echo "<b><small>IP: $ip + Browser: $brows Is Banned Now !</small></b>";
}
break;

case 'razip':
$q = mysql_query("select * from bannedib where ci='".$ci."' order by mid desc;");
if(empty($act)) {
while($arr=mysql_fetch_array($q)) {
echo "<small><a href=\"admin.php?ci=$ci&amp;id=$id&amp;act=del&amp;pass=$pass&amp;mod=razip&amp;mid=".$arr['mid']."&amp;cid=$cid\">".$arr['ip'].",".$arr['browser']."</a></small><br/>";
}
} else {
if(mysql_query("delete from bannedib where ci='$ci' AND mid='$mid' limit 1;")) echo "<b><small>IP + BROWSER UnBanned Now !</small></b><br/>";
}
break;

        case 'delltrs':
        if(@mysql_query(" delete from `chat_letters` where ci='$ci';")) {echo "Letters Deleted Now !";}
        else {echo "Some Error";}
        break;

        case 'editnameroom':
        if(empty($act)) {
        echo "Room name:<br/><input type=\"text\" name=\"t\"/><br/>Room:<br/><select name=\"name\">";
        $q = @mysql_query("select * from `".$px.$stable."` where `mod`='room' and ci='$ci';");
        while ($dbdata = @mysql_fetch_array($q)) {
        echo "<option value=\"".$dbdata['var']."\">".$dbdata['val1']."</option>"; }
        echo "</select><br/>
        <anchor>OK<go href=\"admin.php?ci=$ci&amp;act=update&amp;id=$id&amp;pass=$pass&amp;mod=$mod\" method=\"post\"><postfield name=\"name\" value=\"$(name)\"/><postfield name=\"t\" value=\"$(t)\"/></go></anchor><br/>";
        } else {
        $t=htmlspecialchars(stripslashes(trim(substr($t,0,50))));
        if(@mysql_query("update `".$px.$stable."` set val1='$t' where `var`='$name' and `mod`='room' and ci='$ci';")) {echo "<b>Room Name Is Changed Now !!!</b>";}
        }
        break;

        case 'editposroom':
        if(empty($act)) {
        echo "Room:<br/><input size=\"2\" name=\"pos\" format=\"*N\"/>
                        <br/>Position:<br/><select name=\"name\">";
        $q = @mysql_query("select * from `".$px.$stable."` where `mod`='room' and ci='$ci';");
        while ($dbdata = @mysql_fetch_array($q)) {
        echo "<option value=\"".$dbdata['var']."\">".$dbdata['val1']."</option>"; }
        echo "</select><br/>
        <anchor>OK<go href=\"admin.php?ci=$ci&amp;act=update&amp;id=$id&amp;pass=$pass&amp;mod=$mod\" method=\"post\"><postfield name=\"name\" value=\"$(name)\"/><postfield name=\"pos\" value=\"$(pos)\"/></go></anchor><br/>";
        } else {

        $pos=htmlspecialchars(stripslashes(trim(substr($pos,0,50))));

        if(@mysql_query("update `".$px.$test."` set val3='$pos' where `var`='$name' and `mod`='room' and ci='$ci';")) echo $lang['done'];
        }
        break;

        case 'getpass':
        if(empty($act)) {
        echo "User:<br/><input type=\"text\" name=\"user\"/><br/>";
        echo "<anchor>OK<go href=\"?ci=$ci&amp;act=update&amp;id=$id&amp;pass=$pass&amp;mod=$mod\" method=\"post\"><postfield name=\"user\" value=\"$(user)\"/></go></anchor><br/>";
        } else {

        $user = htmlspecialchars(stripslashes(trim(substr($user,0,50))));

        $q = @mysql_query("select pass from `".$px.$utable."` where login='$user' and ci='$ci' limit 1;");
        $duser = @mysql_fetch_array($q);
        if($duser) echo "<b>Password of $user - ".$duser['pass']." !</b><br/>";
        else echo $lang['user_not_exist'];
        }
        break;

        case 'createroommod':
        if(empty($act)) {
        echo "create Room:<br/><input type=\"text\" name=\"name\"/><br/>";
        echo "Position:<br/><input size=\"2\" name=\"pos\" format=\"*N\"/><br/>";
        echo "<anchor>Create<go href=\"admin.php?ci=$ci&amp;act=update&amp;id=$id&amp;pass=$pass&amp;mod=$mod\" method=\"post\"><postfield name=\"name\" value=\"$(name)\"/><postfield name=\"pos\" value=\"$(pos)\"/></go></anchor><br/>";
        } else {
        $query = @mysql_query("select * from `".$px.$test."` where `mod`='room' and ci='$ci' order by id desc;");
        $db = @mysql_fetch_array($query);
        $ex = intval(substr($db['var'], 4));
        $i = $ex + 10;
        $name=htmlspecialchars(stripslashes(trim(substr($name,0,50))));
        $pos=htmlspecialchars(stripslashes(trim(substr($pos,0,10))));
        if(@mysql_query("insert into `".$px.$test."` values(0, 'room', 'room".$i."', '$name', '$name', '$pos', '$ci');")) echo "<b>Created Sucessful!</b><br/>";
        }
        break;

        case 'createroom':
        if(empty($act)) {
        echo "Room name:<br/><input type=\"text\" name=\"name\"/><br/>";
        echo "Room Position:<br/><input size=\"2\" name=\"pos\" format=\"*N\"/><br/>";
        echo "<anchor>Create<go href=\"admin.php?ci=$ci&amp;act=update&amp;id=$id&amp;pass=$pass&amp;mod=$mod\" method=\"post\"><postfield name=\"name\" value=\"$(name)\"/><postfield name=\"pos\" value=\"$(pos)\"/></go></anchor><br/>";
        } else {
        $query = @mysql_query("select * from `".$px.$stable."` where `mod`='room' and ci='$ci' order by id desc;");
        $db = @mysql_fetch_array($query);
        $ex = intval(substr($db['var'], 4));
        $i = $ex + 1;
        $name=htmlspecialchars(stripslashes(trim(substr($name,0,50))));
        $pos=htmlspecialchars(stripslashes(trim(substr($pos,0,10))));
        if(@mysql_query("insert into `".$px.$stable."` values(0, 'room', 'room".$i."', '$name', '$name', '$pos', '$ci');")) echo "<b>Created Successful</b><br/>";
        }
        break;

        case "delroommod":
        if(empty($act)) {
        echo "Delete user room:<br/><select name=\"name\">";
        $q = @mysql_query("select * from `".$px.$test."` where `mod`='room' and ci='$ci';");
        while ($dbdata = @mysql_fetch_array($q)) {
        echo "<option value=\"".$dbdata['var']."\">".$dbdata['val1']."</option>"; }
        echo "</select><br/>
        <anchor>Delete<go href=\"?ci=$ci&amp;act=del&amp;id=$id&amp;pass=$pass&amp;mod=$mod\" method=\"post\"><postfield name=\"name\" value=\"$(name)\"/></go></anchor><br/>";
        } else {

        if(@mysql_query("delete from `".$px.$test."` where `var`='$name' and `mod`='room' and ci='$ci';")) echo $lang['done'];
        }
        break;

        case 'editnik':
        if(empty($act)) {
        echo "Nick:<br/><input type=\"text\" name=\"old\"/><br/>";
        echo "Change to:<br/><input type=\"text\" name=\"new\"/><br/>";
        echo "<anchor>OK<go href=\"?ci=$ci&amp;act=update&amp;id=$id&amp;pass=$pass&amp;mod=$mod\" method=\"post\"><postfield name=\"old\" value=\"$(old)\"/><postfield name=\"new\" value=\"$(new)\"/></go></anchor><br/>";
        } else {
        $q = @mysql_query("select * from `".$px.$utable."` where login='$new' and ci='$ci' limit 1;");
        $ud = @mysql_fetch_array($q);
        if($ud['id']) { echo $lang['such_nick_exist']; } else {
        if(@mysql_query("update `".$px.$utable."` set login='$new' where login='$old' and ci='".$ci."';")) {echo "Edited Successful";}
         }
        }
        break;

        case "delroom":
        if(empty($act)) {
        echo "Room:<br/><select name=\"name\">";
        $q = @mysql_query("select * from `".$px.$stable."` where `mod`='room' and ci='$ci';");
        while ($dbdata = @mysql_fetch_array($q)) {
        echo "<option value=\"".$dbdata['var']."\">".$dbdata['val1']."</option>"; }
        echo "</select><br/>
        <anchor>Delete<go href=\"?ci=$ci&amp;act=del&amp;id=$id&amp;pass=$pass&amp;mod=$mod\" method=\"post\"><postfield name=\"name\" value=\"$(name)\"/></go></anchor><br/>";
        } else {

        if(@mysql_query("delete from `".$px.$stable."` where `var`='$name' and `mod`='room' and ci='$ci';")) echo $lang['done'];
        }
        break;

        default:
echo "<small><a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=editnameroom\">Edit room name</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=editposroom\">Edit room position</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=cash\">Give Cash</a><br/>";   
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=createroom\">create room</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=restore\">Restore User</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=createroommod\">Create User Room</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=delroommod\">Delete User Room</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=delroom\">Delete room</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=addmeet\">Add Quiz Questions</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=delmeet\">Delete Quiz Question</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=smilie\">Change smilie number</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=team\">Change Team</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=rapwins\">Add Rap wins</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=ava\">Avatar</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=raplose\">Add Rap lose</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=getpass\">Get Pass</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=teampoints\">Team Points</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=ipb&amp;ref=$ref\">Ip Bann</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=razip&amp;ref=$ref\">Restore Ip</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=photo\">Add photo</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=editnik\">Edit nickname</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=quiz\">Quiz Points</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=posts\">change post</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=setstatus\">Change status</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=intro\">Change Introduction</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=delmsgs\">clear chat</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=log\">Mod Log</a><br/>";
echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;mod=delltrs\">Delete inbox</a></small><br/>";
break;
        }

        if($mod) {
        echo "<br/>---<br/><anchor>Previous Page<prev/></anchor><br/>";
        echo "<a href=\"admin.php?ci=$ci&amp;id=$id&amp;pass=$pass\">Administrator</a><br/>";
        }
        if($room)
        echo "<a href=\"./room.php?ci=$ci&amp;id=$id&amp;pass=$pass&amp;room=$room\">Back To Chat</a><br/>";
        else
        echo "<small>---<br/><a href=\"./enter.php?ci=$ci&amp;id=$id&amp;pass=$pass\">Hall</a></small><br/>";
        } else { echo "You Are Not A Owner !!!"; }
 } else { echo "<img src=\"./image/not.gif\" alt=\"X\"/><br/><b>Your IP is Not Match With Owner IP.</b>"; }
echo "</p></card></wml>";
}
@mysql_close();
ob_end_flush();
?>